package com.mysite.springbootdemo.config;

import com.mysite.springbootdemo.interceptor.CustomerInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

@Configuration
public class CustomerWebMvcConfigurerAdapter extends WebMvcConfigurerAdapter {

	@Override
	public void addInterceptors(InterceptorRegistry registry) {
		// addPathPatterns 添加拦截规则，excludePathPatterns 排除拦截
		registry.addInterceptor(new CustomerInterceptor()).addPathPatterns("/**").excludePathPatterns("/");
		super.addInterceptors(registry);
	}
}
